package game.game2;

import java.awt.*;

/**
 * 游戏物体根类
 */
public class gameobject {

    Image fj = gameutil.getImage("img/fj.jpg");     //飞机图片
    double x,y;
    int speed;
    int width,height;

    public gameobject(Image fj, double x, double y, int speed, int width, int height) {
        this.fj = fj;
        this.x = x;
        this.y = y;
        this.speed = speed;
        this.width = width;
        this.height = height;
    }
    public gameobject(){}

    public void drawmyself(Graphics g) {
        g.drawImage(fj, (int)x,(int)y,width,height,null);
    }
    //所以的物体都是矩形，当获得对应的矩形的时候就额可以做一些相关的判断操作
    public Rectangle getRec(){
        return new Rectangle((int)x,(int)y, width, height);
    }

}
